package com.tt.vertx.service

import io.vertx.core.http.HttpServerResponse
import io.vertx.ext.web.RoutingContext

/**
 * @description
 *
 * @author zhanglu
 * @date 2017/11/12 12:00
 */
fun test(context: RoutingContext) {
    val param = context.request().getParam("test")
    println("receive param is " + param)
    context.response().html().end("你传过来的参数是:" + param)
}


fun HttpServerResponse.html(): HttpServerResponse {
    return this.putHeader("content-type", "text/html")
}

fun HttpServerResponse.json(): HttpServerResponse {
    return this.putHeader("content-type", "application/json; charset=utf-8")
}